{extend name='common/_container'}
{block name="content"}
<div class="ibox float-e-margins">
	<div class="ibox-content">
		<div class="form-horizontal" id="CodeInfoForm">
			<div class="row">
				<div class="col-sm-12">
				<!-- form start -->
					<div class="form-group">
						<label class="col-sm-2 control-label">应用名称：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="application_name" value="" name="application_name" class="form-control" placeholder="请输入应用名称">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">操作用户：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="username" value="" name="username" class="form-control" placeholder="请输入操作用户">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">请求url：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="url" value="" name="url" class="form-control" placeholder="请输入请求url">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">ip：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="ip" value="" name="ip" class="form-control" placeholder="请输入ip">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">useragent：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="useragent" value="" name="useragent" class="form-control" placeholder="请输入useragent">
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">请求内容：</label>
						<div class="col-sm-9">
							<textarea id="content" name="content"  class="form-control" placeholder="请输入请求内容"></textarea>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">异常信息：</label>
						<div class="col-sm-9">
							<input type="text" autocomplete="off" id="errmsg" value="" name="errmsg" class="form-control" placeholder="请输入异常信息">
						</div>
					</div>
					<div class="form-group layui-form">
						<label class="col-sm-2 control-label">类型：</label>
						<div class="col-sm-9">
							<?php if(!isset($info['type'])){ $info['type'] = '1'; }; ?>
							<input name="type" value="1" type="radio" {if condition="$info.type eq '1'"}checked{/if} title="登录日志">
							<input name="type" value="2success" type="radio" {if condition="$info.type eq '2success'"}checked{/if} title="操作日志">
							<input name="type" value="3" type="radio" {if condition="$info.type eq '3'"}checked{/if} title="异常日志">
						</div>
					</div>
				<!-- form end -->
				</div>
			</div>
			<div class="hr-line-dashed"></div>
			<div class="row btn-group-m-t">
				<div class="col-sm-9 col-sm-offset-1">
					<button type="button" class="btn btn-primary" onclick="CodeInfoDlg.add()" id="ensure">
						<i class="fa fa-check"></i>&nbsp;确认提交
					</button>
					<button type="button" class="btn btn-danger" onclick="CodeInfoDlg.close()" id="cancel">
						<i class="fa fa-eraser"></i>&nbsp;取消
					</button>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/plugins/layui/layui.js?t=1498856285724" charset="utf-8"></script>
<script src='__PUBLIC__/static/js/plugins/paixu/jquery-migrate-1.1.1.js'></script>
<script src='__PUBLIC__/static/js/plugins/paixu/jquery.dragsort-0.5.1.min.js'></script>
<script>
layui.use(['form'],function(){});
laydate.render({elem: '#create_time',type: 'datetime',trigger:'click'});
var CodeInfoDlg = {
	CodeInfoData: {},
	validateFields: {
	 }
}

CodeInfoDlg.collectData = function () {
	this.set('id').set('application_name').set('username').set('url').set('ip').set('useragent').set('content').set('errmsg').set('create_time');
};

CodeInfoDlg.add = function () {
	 this.clearData();
	 this.collectData();
	 if (!this.validate()) {
	 	return;
	 }
	 var type = $("input[name = 'type']:checked").val();
	 var ajax = new $ax(Feng.ctxPath + "/Log/add", function (data) {
	 	if ('00' === data.status) {
	 		Feng.success(data.msg,1000);
	 		window.parent.CodeGoods.table.refresh();
	 		CodeInfoDlg.close();
	 	} else {
	 		Feng.error(data.msg + "！",1000);
		 }
	 })
	 ajax.set('type',type);
	 ajax.set(this.CodeInfoData);
	 ajax.start();
};


</script>
<script src="__PUBLIC__/static/js/base.js" charset="utf-8"></script>
{/block}
